home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Source Code
/
C++
/
Applications
/
NeuroSim 1.0
/
.cp
/
CMyCaption.cp
next >
Wrap
Text File
|
1996-02-19
|
2KB
|
63 lines
// ===========================================================================
// CMyCaption.cp ©1995 Timo Eloranta
// ===========================================================================
// A subclass of LCaption which uses TETextBox for drawing just like
// LCaption did before this changed in CW7...
#include "CMyCaption.h"
#include <LStream.h>
#include <UDrawingUtils.h>
#include <UTextTraits.h>
#ifndef __TEXTUTILS__
#include <TextUtils.h>
#endif
// ---------------------------------------------------------------------------
// • CreateMyCaptionStream
// ---------------------------------------------------------------------------
// Create a new CMyCaption object from the data in a Stream
CMyCaption*
CMyCaption::CreateMyCaptionStream(
LStream *inStream)
{
return (new CMyCaption(inStream));
}
// ---------------------------------------------------------------------------
// • CMyCaption(LStream*)
// ---------------------------------------------------------------------------
// Construct from data in a Stream
CMyCaption::CMyCaption( LStream *inStream)
: LCaption( inStream )
{
}
// ---------------------------------------------------------------------------
// • DrawSelf
// ---------------------------------------------------------------------------
// Draw the Caption
void
CMyCaption::DrawSelf()
{
Rect frame;
CalcLocalFrameRect(frame);
Int16 just = UTextTraits::SetPortTextTraits(mTxtrID);
RGBColor textColor;
::GetForeColor(&textColor);
ApplyForeAndBackColors();
::RGBForeColor(&textColor);
// Next up is the difference between this class and LCaption.
// I use TETextBox just like LCaption did until this changed with CW7.
::TETextBox((Ptr)&mText[1], mText[0], &frame, just);
// UTextDrawing::DrawWithJustification((Ptr)&mText[1], mText[0], frame, just);
}